package phone.example.com.a36kr.other.mybmob;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import cn.bmob.v3.BmobUser;

/**
 * Created by dllo on 16/8/27.
 */

public class MyBmobUser extends BmobUser{
    private byte[] icon; //用户头像

   public void setIcon(Bitmap bitmap){
       ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
       bitmap.compress(Bitmap.CompressFormat.PNG, 100 , byteArrayOutputStream);

       icon = byteArrayOutputStream.toByteArray();
       try {
           byteArrayOutputStream.close();
       } catch (IOException e) {
           e.printStackTrace();
       }
   }
    public Bitmap getIcon(){
        if (icon != null){
            Bitmap bitmap = BitmapFactory.decodeByteArray(icon,0,icon.length);
            return bitmap;
        }
        return null;
    }

    /***获取头像****/
}
